package com.soul.boothystrix.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hystrix")
public class HystrixController {

    @GetMapping("/index")
    @HystrixCommand(fallbackMethod = "index2")
    public String index(){
        int i = 1 / 0;
        return null;
    }

    public String index2(){
        return "hello world";
    }
}
